/*
 *  AMediaFileDesc.cpp
 *  libavid
 *
 *  Created by Peter on 25.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#include "AMediaFileDesc.h"
#include "AStream.h"

A_IMPLEMENT_CLASS( 'MDFL', AMediaFileDesc, AMediaDesc );

void AMediaFileDesc::readFromStream( AStream& str, const AObjDoc& objd )
{
	AMediaDesc::readFromStream( str, objd );
	
	UInt8 tagMark, version;
	str.readPod( tagMark );
	str.readPod( version );
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x03 );
	
	str.readPod( _edRateMantissa );
	str.readPod( _edRateExpo10 );  
	str.readPod( _length );        
	str.readPod( _isOmfi );        
	str.readPod( _dataOffset );
}

#define TRACE_FIELD( x ) "\t" #x ": " << x << std::endl

void AMediaFileDesc::dump( std::ostream& str ) const
{
	str << "AMediaFileDesc {" << std::endl;
	
	str << "\t";
	AMediaDesc::dump( str );
	
	str << TRACE_FIELD( _edRateMantissa );
	str << TRACE_FIELD( _edRateExpo10 );
	str << TRACE_FIELD( _length );
	str << TRACE_FIELD( _isOmfi ),
	str << TRACE_FIELD( _dataOffset );
	
	str << "}" << std::endl;
}